home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-imgrea.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  68 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                      S Y S T E M . I M G _ R E A L                       --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.6 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- The GNAT library is free software; you can redistribute it and/or modify --
  14. -- it under terms of the GNU Library General Public License as published by --
  15. -- the Free Software  Foundation; either version 2, or (at your option) any --
  16. -- later version.  The GNAT library is distributed in the hope that it will --
  17. -- be useful, but WITHOUT ANY WARRANTY;  without even  the implied warranty --
  18. -- of MERCHANTABILITY  or  FITNESS FOR  A PARTICULAR PURPOSE.  See the  GNU --
  19. -- Library  General  Public  License for  more  details.  You  should  have --
  20. -- received  a copy of the GNU  Library  General Public License  along with --
  21. -- the GNAT library;  see the file  COPYING.LIB.  If not, write to the Free --
  22. -- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.        --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  Image for fixed and float types (also used for Float_IO/Fixed_IO output)
  27.  
  28. package System.Img_Real is
  29. pragma Preelaborate (Img_Real);
  30.  
  31.    function Image_Ordinary_Fixed_Point
  32.      (V    : Long_Long_Float;
  33.       S    : access String;
  34.       Aft  : Natural)
  35.       return Natural;
  36.    --  Computes the image of V and stores the resulting string in S (1 .. N)
  37.    --  according to the rules for image for fixed-point types (RM 3.5(34)),
  38.    --  where Aft is the value of the Aft attribute for the fixed-point type.
  39.    --  This function is used only for ordinary fixed point (see package
  40.    --  System.Img_Decimal for handling of decimal fixed-point). The caller
  41.    --  guarantees that the string is long enough.
  42.  
  43.    function Image_Floating_Point
  44.      (V    : Long_Long_Float;
  45.       S    : access String;
  46.       Digs : Natural)
  47.       return Natural;
  48.    --  Computes the image of V and stores the resulting string in S (1 .. N)
  49.    --  according to the rules for image for foating-point types (RM 3.5(33)),
  50.    --  where Digs is the value of the Digits attribute for the floating-point
  51.    --  type. The caller guarantees that the string is long enough.
  52.  
  53.    procedure Set_Image_Real
  54.      (V    : Long_Long_Float;
  55.       S    : out String;
  56.       P    : in out Natural;
  57.       Fore : Natural;
  58.       Aft  : Natural;
  59.       Exp  : Natural);
  60.    --  Sets the image of V starting at S (P + 1), updating P to point to the
  61.    --  last character stored, the caller promises that the buffer is large
  62.    --  enough and no check is made for this. Constraint_Error will not
  63.    --  necessarily beraised if this is violated, since it is perfectly valid
  64.    --  to compile this unit with checks off). The Fore, Aft and Exp values
  65.    --  can be set to any valid values for the case of use from Text_IO.
  66.  
  67. end System.Img_Real;
  68.